var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
    })(e, t);
}, function(e, t) {
    function n() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, 
    new n());
}), a = this && this.__decorate || function(e, t, o, n) {
    var s, i = arguments.length, r = i < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, o) : n;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, o, n); else for (var a = e.length - 1; 0 <= a; a--) (s = e[a]) && (r = (i < 3 ? s(r) : 3 < i ? s(t, o, r) : s(t, o)) || r);
    return 3 < i && r && Object.defineProperty(t, o, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("PersonView"), s = e("Global"), c = e("AudioManager"), l = e("GameData"), d = e("EggsManager"), u = e("DataManager"), p = e("UIManager"), h = e("WebManager"), f = cc._decorator, g = f.ccclass, m = f.property, y = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.personView = null, e.spriteNode = null, e.shadow = null, e.time = 3, e.count = 0, 
        e.total = 7, e.idx = 7, e;
    }
    return i(e, t), e.prototype.onLoad = function() {
        cc.systemEvent.on("refresh_person_skin", this.doRefresh, this);
    }, e.prototype.onDestroy = function() {
        cc.systemEvent.off("refresh_person_skin", this.doRefresh, this);
    }, e.prototype.onClick = function() {
        -1 == d.default.getInstance().checkEggPerson(this.idx) && (0 == this.count && this.scheduleOnce(this.doTimer, this.time), 
        this.count < this.total ? (h.default.getInstance().sentLog("触发皮肤彩蛋id:" + this.idx), 
        this.count++) : (h.default.getInstance().sentLog("获得皮肤彩蛋id:" + this.idx), c.default.getInstance().playAudio("皮肤出现"), 
        this.shadow.parent = cc.Canvas.instance.node, this.shadow.active = !0, c.default.getInstance().playAudio("彩蛋皮肤" + s.G.eggPersonModelList[this.idx].m, 1), 
        this.shadow.parent = this.node, this.shadow.active = !1, p.default.getInstance().loadPopPnl("egg_reward", {
            type: s.RewardType.SKIN,
            idx: this.idx
        }), d.default.getInstance().updateEggPerson(this.idx), l.GD.personIdx = -1 - this.idx, 
        l.GD.eggsHintState = 1, u.default.getInstance().save(), cc.systemEvent.off("refresh_person_skin", this.doRefresh, this)));
    }, e.prototype.start = function() {
        this.doRefresh();
    }, e.prototype.doRefresh = function() {
        15 == this.personView.personIdx ? this.node.active = !0 : this.node.active = !1;
    }, e.prototype.doTimer = function() {
        this.count = 0;
    }, e.prototype.stopTimer = function() {
        this.unschedule(this.doTimer);
    }, e.prototype.update = function() {
        this.personView && this.personView.updateBySlot(this.spriteNode);
    }, a([ m(r.default) ], e.prototype, "personView", void 0), a([ m(cc.Node) ], e.prototype, "spriteNode", void 0), 
    a([ m(cc.Node) ], e.prototype, "shadow", void 0), a([ g ], e);
}(cc.Component);

n.default = y;